home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Just Call Me Internet
/
Just Call Me Internet.iso
/
prog
/
mint
/
duftp
/
ftp.h
< prev
next >
Wrap
C/C++ Source or Header
|
1995-06-12
|
3KB
|
96 lines
/*
DUFTP
*/
// FTP (HEADER)
#ifndef _FTP_H_
#define _FTP_H_
#include <DULIB.H>
#include <UNISTD.H>
#include <STDIO.H>
#include <SIGNAL.H>
#include <NETDB.H>
#include <PWD.H>
#include <TYPES.H>
#include <NETINET\IN.H>
#include <SYS\SOCKET.H>
#define HASHBYTES 1024
typedef struct {
char *s_name; // official service name
char **s_aliases; // alias list
int s_port; // port #
char *s_proto; // protocol to use
} DU_servent;
typedef struct {
char *h_name; // official name of host
char **h_aliases; // alias list
int h_addrtype; // host address type
int h_length; // length of address
char **h_addr_list; // list of addresses from name server
#define h_addr h_addr_list[0] // address, for backward compatiblity
} DU_hostent;
// Socket address, internet style.
typedef struct sockaddr_internet {
short sin_family;
unsigned short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
} DU_sockaddr_in;
extern DU_servent *sp; // service spec for tcp/ftp
extern char homedir[FMSIZE]; // home directory (initial)
extern FILE *cin;
extern FILE *cout;
extern FILE *dataconn();
extern int data;
extern int connected; // are we connected to a server ?
extern char *hostname; // name of the host we are connected to
extern int type;
extern int form;
extern int mode;
extern int stru;
extern int bytesize;
extern int cpend;
extern int proxy;
extern int crflag;
extern struct sockaddr_in hisctladdr;
extern struct sockaddr_in data_addr;
extern int data;
extern int abrtflag;
extern int ptflag;
extern int allbinary;
extern struct sockaddr_in myctladdr;
extern off_t restart_point;
extern char reply_string[BUFSIZ]; // last line of previous reply
extern char pasv[64]; // passive port for proxy data connection
// Routines that can be called by other modules fairly painlessly
extern void initialise_ftp(void); // Initialises all the stuff to do with the FTP routines
extern void connect_to_server(char *server_name); // Open an FTP link to a named server (high level view)
extern void remote_ls(char *local, char *remote); // Get a directory listing from remote server into local file.
extern void remote_cd(char *remote_directory); // Change the remote directory
extern void remote_get(char *local, char *remote); // Get a file from the remote server
char *remote_pwd(void); // Get the current remote directory
extern void disconnect(void); // Terminate the current session
// Internal routines, don't call these unless you understand them
extern void lostpeer(int a); // Signal handler for lost connections
extern short send_command(char *command_to_send); // Send a command to remote server, and get reply
extern int getreply(int expecteof); // get a reply from the remote server
extern char *hookup(char *host, int port); // Actually do the connect to the remote FTP server
extern void recvrequest(char *cmd, char *local, char *remote, char *mode, short printnames);
extern char *gunique(char *local);
extern short initconn(void);
extern FILE *dataconn(char *mode);
void report_bytes_transferred(char *direction, long bytes);
#endif